import Vue from 'vue';
import Router from 'vue-router'

Vue.use(Router);
const routes = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        name: 'home',
        component: () => import('./view/home'),
        meta: {
            title: '首页'
        }
    },
    {
        name: 'm_home',
        component: () => import('./view/m_home'),
        meta: {
            title: '首页'
        }
    },
    {
        name: 'tally',
        component: () => import('./view/tally'),
        meta: {
            title: '记账'
        }
    },
    {
        name: 'addTag',
        component: () => import('./view/addTag'),
        meta: {
            title: '添加类别'
        }
    },
    // PayTypeList
    {
        name: 'PayTypeList',
        component: () => import('./view/PayTypeList'),
        meta: {
            title: '流水'
        }
    },
    {
        name: 'chart',
        component: () => import('./view/chart'),
        meta: {
            title: '图表'
        }
    }
];

routes.forEach(route => {
    route.path = route.path || '/' + (route.name || '');
});

const  router = new Router({
    mode: 'history',
    routes,
    publicPath: '/'
});

export {
    router
}
